# coding=utf-8
"""
author: jamon
"""
import math
from typing import Tuple

_need_reload = True


def get_tar_position(orgin_position: 'Position', x: int, y: int) -> 'Position':
    return Position(orgin_position.x + x, orgin_position.y + y)


class Position(object):

    def __init__(self, x: int, y: int):
        self.x = x
        self.y = y

    def __str__(self):
        return "Position:x={}, y={}".format(self.x, self.y)

    __repr__ = __str__

    def get_distance(self, tar_position: 'Position') -> Tuple[int, int]:
        """
        获取两个点的juli
        :param tar_position:
        :return:
        """
        return int(math.fabs(self.x - tar_position.x)), int(math.fabs(self.y - tar_position.y))

    def get_road_to_position(self,  tar_position: 'Position') -> Tuple[int, int]:
        # 获取到指定目标点的移动距离（不考虑方向和障碍物）
        return tar_position.x - self.x, tar_position.y - self.y
